From: ss37@irz.inf.tu-dresden.de (Sven Steiniger)
Date: Tue, 9 Apr 1996 11:55:36 +0200
Message-Id: <199604090955.LAA00764@irz110.inf.tu-dresden.de>
To: mui@sunsite.Informatik.RWTH-Aachen.DE
Subject: Re: Q:Hooks, MUI and dispatchers
Resent-Message-Id: <"Ur2vh2.0.DB6.dHZQn"@sunsite>
Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE
Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE
X-Mailing-List:  archive/latest/973
X-Loop: mui@sunsite.informatik.rwth-aachen.de
Precedence: list
Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE
Content-Type: text
Content-Length: 1265
X-Lines: 43
Status: RO

joop van de wege wrote:

>I have a question about the mentioned subject.
>I have ported a C compiler which doens't have the keyword REG (reg/__reg) so
>all examples (Class{1|2|3}.c) from MUI33dev that use dispatcher functions
>don't work when I remove the offending keyword.
>I know there is a function HookEntry() in Amigalib but I can't figure out how
>to use it in the examples.
>Is there someone who can tell me how todo that, by posting either a corrected
>example from MUI33dev or plain telling how to??

Here is the source that does something similar to HookEntry().
It is written in E for E by Wouter van Oortmersson. But should be
easy to convert.

Ciao, Sven.


/* 'hook' - pointer to your hook-structure
** 'func' - pointer to your function
** returns 'hook'
*/
PROC installhook(hook,func)
  MOVE.L  hook,A0
  MOVE.L  func,12(A0)
  LEA     hookentry(PC),A1
  MOVE.L  A1,8(A0)
  MOVE.L  A4,16(A0)         -> a4..global variables
  MOVE.L  A0,D0
ENDPROC D0

hookentry:
  MOVEM.L D2-D7/A2-A6,-(A7)
  MOVE.L  16(A0),A4         -> restore a4
  MOVE.L  A0,-(A7)          -> put arguments on stack
  MOVE.L  A2,-(A7)
  MOVE.L  A1,-(A7)
  MOVE.L  12(A0),A0
  JSR     (A0)              -> call function
  LEA     12(A7),A7
  MOVEM.L (A7)+,D2-D7/A2-A6
  RTS